
#include "SocketMatTransmissionClient.h"
#include <thread.h>
#include "uart.h"
#include <sys/time.h>

long int ms1=0;
long int ms2=0;

int main()
{
	struct timeval tv;
    gettimeofday(&tv, NULL);//
    int m=0;
    
	//if (SocketMat.SocketConnect("192.168.184.133", 8081) < 0)
	if (SocketMat.SocketConnect("192.168.184.11", 8081) < 0)
	//if (SocketMat.SocketConnect("192.168.101.144", 8081) < 0)
	{
		return -1;
	}
	
	//Uart0.Uart_Init((char*)"/dev/ttyAMA0", 115200);//
	
	thread_Init();
	
	/*
	cv::VideoCapture capture(0);//打开摄像头
	if (!capture.isOpened())
			return 0;
	*/	
	//cv::Mat image;//
	
	while(1)
	{
		/*
		capture >> image;//读取视频的一帧 /图片
		if (image.empty())
			return 0;
		gettimeofday(&tv, NULL);//获取时间戳
		//ms1=tv.tv_sec*1000 + tv.tv_usec/1000;//ms	
		socketMat.transmit_server_2(image);//传输
		*/
		//printf("ms: %d-%ld\n", m, tv.tv_sec*1000 + tv.tv_usec/1000);  //ms	
		//m++;
		
		//gettimeofday(&tv, NULL);//
		//ms1=tv.tv_sec*1000 + tv.tv_usec/1000;//ms	
		//socketMat.transmit(image);
		
		//printf("ms: %ld\n", tv.tv_sec*1000 + tv.tv_usec/1000);  //ms	
		//cv::waitKey(1);//等待(ms)
		//waitKey(500);//等待(ms)
		//socketMat.transmit_server();
		//sleep(3);
		
	}

	SocketMat.SocketDisconnect();
	return 0;
}
